package com.recipedb.recipedb.service;

import org.springframework.data.domain.Page;
import com.recipedb.recipedb.entity.Recipe;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public interface RecipeService {
    Recipe save(Recipe entity);
    void deleteById(Long id);
    Optional<Recipe> findById(Long id);
    List<Recipe> findAll();
    List<Recipe> findByUserId(Long userId);
    Optional<Recipe> partialUpdate(Long id, Recipe entity);
    List<Recipe> search(String keyword, String tag, String category, String ingredient);
    Long getFavoriteCountByRecipeId(Long recipeId);
    Long getTotalFavoritesByUserId(Long userId);
    List<Recipe> setFavoriteCountsForRecipes(List<Recipe> recipes);
    Recipe setFavoriteCountForRecipe(Recipe recipe);
    Map<Long, Long> refreshAndGetChangedFavoriteCounts();

    // ========== 新增：我的发布分页搜索 ==========
    Page<Recipe> searchUserRecipes(
            Long userId,          // 当前登录用户ID
            String keyword,       // 标题关键词
            String tag,           // 标签
            String category,      // 分类
            String ingredient,    // 食材
            Integer pageNum,      // 页码
            Integer pageSize);    // 每页条数
}